package com.cuzofu.fs.controller;

import java.util.Arrays;
import java.util.Map;

import com.cuzofu.fs.common.PageUtils;
import com.cuzofu.fs.common.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.cuzofu.fs.entity.MarkEntity;
import com.cuzofu.fs.service.MarkService;


/**
 * 标注信息
 *
 * @author cuzofu
 * @email cuzofu@qq.com
 * @date 2020-07-10 08:44:49
 */
@RestController
@RequestMapping("/mark")
public class MarkController {
    @Autowired
    private MarkService markService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = markService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id) {
        MarkEntity mark = markService.getById(id);

        return R.ok().put("mark", mark);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody MarkEntity mark) {
        markService.save(mark);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody MarkEntity mark) {
        markService.updateById(mark);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] ids) {
        markService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
